/*
 * Created by IntelliJ IDEA.
 * User: amrk
 * Date: 10/06/2004
 * Time: 20:56:00
 */
package com.talios.jira.browser;

import com.talios.jira.browser.signals.JiraServerDetails;

import javax.swing.*;
import java.util.List;

public class ServerComboBoxModel extends DefaultComboBoxModel {
    private List serverList;

    public ServerComboBoxModel(List serverList) {
        this.serverList = serverList;
    }

    // implements javax.swing.ListModel
    public int getSize() {
        return serverList == null ? 0 : serverList.size();
    }

    // implements javax.swing.ListModel
    public Object getElementAt(int index) {
        JiraServerDetails serverDetails = (JiraServerDetails) serverList.get(index);
        if (serverDetails != null) {
            return serverDetails.getBaseurl();
        } else {
            return "ERR";
        }

    }

}